package com.piggy.common.log.service;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.logi.sys.api.RemoteLogiLogService;
import com.piggy.logi.sys.api.domain.LogiSysOperLog;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.piggy.sys.api.RemoteLogService;
import com.piggy.sys.api.domain.SysOperLog;

import javax.annotation.Resource;

/**
 * 异步调用日志服务
 *
 * @author shark
 */
@Service
public class AsyncLogService {

    @Resource
    private RemoteLogService remoteLogService;

    @Resource
    private RemoteLogiLogService remoteLogiLogService;

    /**
     * 保存系统日志记录
     */
    @Async
    public void saveSysLog(SysOperLog sysOperLog) {
        remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
    }

    /**
     * 保存系统日志记录
     */
    @Async
    public void saveSysLogiLog(LogiSysOperLog sysOperLog) {
        remoteLogiLogService.saveLog(sysOperLog, SecurityConstants.INNER);
    }
}
